﻿using System.Collections.Generic;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Web;
using DemoLib.Shared.Models;

namespace DemoLib.Shared.Contracts
{
    [ServiceContract(Namespace = "DemoService",
        ProtectionLevel = ProtectionLevel.None,
        SessionMode = SessionMode.Allowed)]
    public interface IUserService
    {
        [OperationContract]
        [WebGet(UriTemplate = "/GetUser?id={Id}")]
        User GetUserById(int id);

        [OperationContract]
        [WebGet(UriTemplate = "/GetRoles", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
        IEnumerable<Role> GetRoles();

        [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "/VarifyUser", BodyStyle = WebMessageBodyStyle.Wrapped,
            ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
        void Register(RegisterUser registerUser);

        [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "/VarifyUser", BodyStyle = WebMessageBodyStyle.Wrapped,
            ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
        User ValidateUser(string userName, string password);
        
        [OperationContract]
        void UpdateUser(User user);

        bool ChangePassword(int userId, string oldPassword, string newPassword);
    }
}
